const {User} = require("../../models/User");

module.exports = async (req, res) => {
    try{
        var {followId, user_id} = req.body
        const up1 = await User.updateOne({user_id: user_id},{ $addToSet : { "follows": [{user_id: followId}] } })
        User.updateOne({user_id: followId},{ $addToSet : {"fans":[{user_id: user_id}]}})
        console.log(up1)
       res.send({errCode:"1",msg:"关注成功"})
    }catch(e){
        res.status(400).send({errCode:"1",msg:"请求错误"})
    }
}